﻿using System.Collections.Generic;

using UnityEngine;

namespace Assets.XyzCode.Fight.Game.Enemy.Think
{
    /// <summary>
    /// 思考 - 复合思考
    /// </summary>
    public class Think_Composit : IThink
    {
        /** 思考列表 */
        private readonly IList<IThink> _thinkList = new List<IThink>();

        // @Override
        public void DoThink(Enemy_X_Behav behav)
        {
            if (null == behav)
            {
                return;
            }

            if (_thinkList.Count <= 0)
            {
                _thinkList.Add(new Think_ApproachPlayer());
                _thinkList.Add(new Think_WaitAndSee());
            }

            int index = Random.Range(0, _thinkList.Count);

            // 获取当前思考
            IThink currThink = _thinkList[index];
            // 执行思考过程
            currThink.DoThink(behav);
        }
    }
}
